﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _23 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<Guid>(
                name: "DepartmentId",
                table: "SysNotice",
                type: "char(36)",
                nullable: true,
                comment: "发送部门",
                collation: "ascii_general_ci",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldNullable: true,
                oldComment: "发送部门");

            migrationBuilder.AlterColumn<Guid>(
                name: "ClassId",
                table: "SysNotice",
                type: "char(36)",
                nullable: true,
                comment: "发送班级",
                collation: "ascii_general_ci",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldNullable: true,
                oldComment: "发送班级");

            migrationBuilder.AddColumn<bool>(
                name: "IsSend",
                table: "SysNotice",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false,
                comment: "原始数据是否已发送");

            migrationBuilder.AddColumn<int>(
                name: "ReceivingPort",
                table: "SysNotice",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "接收端");

            migrationBuilder.UpdateData(
                table: "SysJob",
                keyColumn: "Id",
                keyValue: new Guid("08da9e05-bd8b-4454-83dc-817372689e3e"),
                columns: new[] { "ActionClass", "IsEnabled", "Name", "Remark" },
                values: new object[] { "Simple.Services.Jobs.NoticeSendJob", true, "消息通知定时发送", "消息通知定时发送（5s/次）" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "IsSend",
                table: "SysNotice");

            migrationBuilder.DropColumn(
                name: "ReceivingPort",
                table: "SysNotice");

            migrationBuilder.AlterColumn<DateTime>(
                name: "DepartmentId",
                table: "SysNotice",
                type: "datetime(6)",
                nullable: true,
                comment: "发送部门",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: "发送部门")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<DateTime>(
                name: "ClassId",
                table: "SysNotice",
                type: "datetime(6)",
                nullable: true,
                comment: "发送班级",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: "发送班级")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.UpdateData(
                table: "SysJob",
                keyColumn: "Id",
                keyValue: new Guid("08da9e05-bd8b-4454-83dc-817372689e3e"),
                columns: new[] { "ActionClass", "IsEnabled", "Name", "Remark" },
                values: new object[] { "Simple.Services.Jobs.TestJob", false, "控制台定时打印（测试）", "控制台定时打印（测试）" });
        }
    }
}
